package com.ypj.indusynergyems.web;

import com.ypj.indusynergyems.dao.entity.GoodsEntity;
import com.ypj.indusynergyems.service.IGoodsService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
@RequiredArgsConstructor
public class SearchGoods {

    private final IGoodsService goodsService;

    @GetMapping("/searchGoods/{goodsId}.html")
    public String goodsItem(@PathVariable int goodsId, Model model){
        //查询该商品的全部信息
        GoodsEntity goods = goodsService.findById(goodsId);
        model.addAttribute("goods",goods);
        return "goods/item";
    }

}
